package com.walter.db.mapper;

import com.walter.db.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wuchenxi
 * @since 2020-08-07
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * 通过用户名查询密码
     *
     * @param account
     * @return
     */
    @Select("select password from user where account = #{account} limit 1")
    String selectPasswordByAccount(@Param("account") String account);

    @Select("select count(id) from user where mail = #{mail}")
    int countByMail(String mail);

    User selectByAccountOrMailAndPassword(@Param("accountOrMail") String accountOrMail, @Param("password") String password);

    User selectByAccountOrMail(String accountOrMail);
}
